#ifndef __APP_MESSAGE_H__
#define __APP_MESSAGE_H__

typedef enum ConnectionTypeEnum
{
    CONNECTION_TYPE_NONE = 0,
    CONNECTION_TYPE_LORA,
    CONNECTION_TYPE_BLE_MESH,
}ConnectionType; 

typedef struct MessageStructstruct
{
    ConnectionType connection_type;  // 链接类型
    unsigned char* payload;                   // 消息体
    int data_len;                    // 数据长度
    int id_len;                      // 设备ID长度
} Message;

/**
*@brief 初始化消息
*@param message 消息指针
*@param binary 二进制数据
*@param len二进制数据长度
*/
int app_message_initByBinary(Message* message, void* binary, int len);
int app_message_initByJson(Message* message, void *json_str, int len);
int app_message_saveBinary(Message *message, void *binary, int len);
int app_message_saveJson(Message *message, void *json_str, int len);

void app_message_free(Message *message);


#endif